//
//  HomeBottomView.m
//  Weibbo
//
//  Created by 李 林刚 on 13-7-14.
//  Copyright (c) 2013年 Omnivores. All rights reserved.
//

#import "HomeBottomView.h"

@implementation HomeBottomView
@synthesize delegate;

-(void)dealloc
{
    UIRelease(settingBtn);
    UIRelease(addLongWeiBoBtn);
    [super dealloc];
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView  *backImageView = [[UIImageView alloc]initWithFrame:self.bounds];
        [backImageView setImage:[UIImage imageNamed:@"home_Bottom"]];
        [self addSubview:backImageView];
        [backImageView release];
        
        settingBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 45, 45)];
        [settingBtn setImage:[UIImage imageNamed:@"setting_normal"] forState:UIControlStateNormal];
        [settingBtn setImage:[UIImage imageNamed:@"setting_select"] forState:UIControlStateHighlighted];
        [settingBtn addTarget:self action:@selector(ToSetting) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:settingBtn];
        
        addLongWeiBoBtn = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(settingBtn.frame)+46, 9,135, 27)];
        [addLongWeiBoBtn setBackgroundImage:[UIImage imageNamed:@"addlongWeibo_normal"] forState:UIControlStateNormal];
        [addLongWeiBoBtn setBackgroundImage:[UIImage imageNamed:@"addLongweibo_Select"] forState:UIControlStateHighlighted];
        [addLongWeiBoBtn addTarget:self action:@selector(AddLongWeibo) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:addLongWeiBoBtn];
        
        UIButton *helpBtn = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.bounds)-45, 0, 45, 45)];
        [helpBtn setBackgroundImage:[UIImage imageNamed:@"help_normal"] forState:UIControlStateNormal];
        [helpBtn setBackgroundImage:[UIImage imageNamed:@"help_select"] forState:UIControlStateHighlighted];
        [helpBtn addTarget:self action:@selector(ToHelpInfo) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:helpBtn];
    }
    return self;
}

-(void)AddLongWeibo
{
    if ([delegate respondsToSelector:@selector(HomeBottomViewDelegateAddLongWeibo)]) {
        [delegate HomeBottomViewDelegateAddLongWeibo];
    }
}

-(void)ToSetting
{
    if ([delegate respondsToSelector:@selector(HomeBottomViewDelegateSetting)]) {
        [delegate HomeBottomViewDelegateSetting];
    }
}

-(void)ToHelpInfo
{
    if ([delegate respondsToSelector:@selector(HomeBottomViewDelegateHelpHiden)]) {
        [delegate HomeBottomViewDelegateHelpHiden];
    }
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
